package com.itheima.controller.exception;


import com.itheima.entity.Result;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;


//注解格式处理异常
@Component
@ControllerAdvice
@ResponseBody
public class ExceptionAdvice {
    @ExceptionHandler(Exception.class)
    public Result doException(Exception e) {
        System.out.println(e);
        return Result.fail("操作失败!");
    }
}
